<?php

/**
 * Description of MaxUserRole
 *
 * @author Mina
 */
class MaxUser
{

    /**
     * array of needed user data
     * @var array  
     */
    private $userData;

    /**
     * array of role tasks for each site component
     * @var MaxUserRole
     */
    private $maxUserRole;

    /**
     * @param array $userData 
     */
    public function __construct(User $user)
    {
        $this->userData = $user->toArray();
        $this->maxUserRole = new MaxUserRole($user);
    }
    
    /**
     *
     * @return array 
     */
    public function getAllUserData()
    {
        return $this->userData;
    }
    /**
     *
     * @param key of needed data
     * @return String
     */
    public function getUserDataByIndex($index)
    {
        return $this->userData[$index];
    }

    
    /**
     *
     * @return MaxUserRole 
     */
    public function getMaxUserRole()
    {
        return $this->maxUserRole;
    }
    
    /**
     *
     * @return Company
     */
    public function getCompany()
    {
        // get user company
        return CompanyTable::getInstance()->findOneByUserId($this->userData['id']);
    }
}
